package org.yyjkcache.thread;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 * 调度线程
 * 
 * @author zhangwei
 *
 */
public class ThreadImpl implements Runnable {
	private static Logger logger= LogManager.getLogger(ThreadImpl.class);
	@SuppressWarnings("rawtypes")
	@Override
	public void run() {
		logger.info(Thread.currentThread()+"开始");
		Dispatch dispatch=null;
		try {
			ConnectionQueue queue = ConnectionQueue.dispatch();	
			while (null != (dispatch=queue.pop())) {
				dispatch.get().save();
			}
			logger.info(Thread.currentThread()+"停止");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
